<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="mall/advert/include::header"></head>
<link rel="stylesheet" type="text/css" href="/css/plugins/layui/layui.css"/>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>主题主图添加</h5>
					</div>
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="signupForm">
							<div class="form-group">
								<label class="col-sm-3 control-label">标题:</label>
								<div class="col-sm-8">
									<input id="advname" name="name" class="form-control" type="text">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">主键:</label>
								<div class="col-sm-8">
									<input id="key" name="key" class="form-control" type="text">
								</div>
							</div>
							<input type="hidden" name="centreId" th:value="${centreId}" th:if="${flag} == '1'">
							<input type="hidden" id="productLinkPrefix" th:value="${productLinkPrefix}">
							<input type="hidden" id="categoryLinkPrefix" th:value="${categoryLinkPrefix}">
							<div class="form-group" th:if="${flag} == '0'">
								<label class="col-sm-3 control-label">商户:</label>
								<div class="col-sm-8">
									<select name="centreId" class="form-control" type="text">
										<option value="" selected="selected">--请选择--</option>
										<option th:each="item: ${centreList}" th:text="${item.name}" th:value="${item.centreId}"></option>
									</select>
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">图片:</label>
								<div class="col-sm-6">
									<input id="pic" name="pic" class="form-control" type="text" onblur="onThumbBlur()">
								</div>
								<div class="col-sm-2">
									<button type="button" onclick="onSelectImgBtnClick('pic','thumbImg')" class="btn btn-primary"><i class="fa fa-check"></i>选择图片</button>
								</div>
							</div>
							<div class="form-group">
								<div class="col-sm-8">
									<label class="col-sm-5 control-label">-</label>
									<img class="img-responsive" id="thumbImg" src="" style="max-width: 30%">
								</div>
							</div>

							<div class="form-group" id='shangjiadiv'>
								<label class="col-sm-3 control-label"
									   for="form-field-1"> 上架时间范围： </label>
								<div class="col-sm-8">
									<div class="col-sm-4 col-xs-6">
										<input type="text" name="upStartTime" id="upStartTime"
											   placeholder="请选择日期时间"
											   readonly="readonly" class="layui-input form-control"
											   style="padding-left: 12px;">
									</div>
									<div class="col-sm-4 col-xs-6">
										<input type="text" name="upEndTime" id="upEndTime"
											   placeholder="请选择日期时间"
											   readonly="readonly" class="layui-input form-control"
											   style="padding-left: 12px;">
									</div>

								</div>
							</div>

							<div class="form-group text-center">
								<div class="col-sm-8 col-sm-offset-2">
									<button type="submit" class="btn btn-primary"><i class="fa fa-check"></i>提交</button>
									<div class="btn btn-danger" onclick="closeDow()"><i class="fa fa-remove"></i> 关闭</div>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div th:include="mall/advert/include::footer"></div>
	<script type="text/javascript" src="/js/appjs/mall/goodspic/add.js"></script>
	<script type="text/javascript" src="/js/plugins/layui/layui.js"></script>
	<script type="text/javascript">
		function closeDow() {
			var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
			parent.layer.close(index);
		}
        layui.use('laydate', function(){
            var laydate = layui.laydate;
            laydate.render({
                elem: '#timestart'
                ,type: 'datetime'
            });

            laydate.render({
                elem: '#timeend'
                ,type: 'datetime'
            });
            laydate.render({
                elem: '#upStartTime' , type: 'datetime'
            });

            laydate.render({
                elem: '#upEndTime' , type: 'datetime'
            });
        })

        $(function() {
            var date = new Date();
            var year = date.getFullYear();
            var mon=date.getMonth()+1 < 10 ? "0"+ date.getMonth()+1:date.getMonth()+1;
            var da=date.getDate() < 10 ? "0"+ date.getDate():date.getDate();
            var h=date.getHours() < 10 ? "0"+ date.getHours():date.getHours();
            var m=date.getMinutes() < 10 ? "0"+ date.getMinutes():date.getMinutes();

            date.setDate(date.getDate()+1);
            var endyear = date.getFullYear();
            var endmon=date.getMonth()+1 < 10 ? "0"+ date.getMonth()+1:date.getMonth()+1;
            var endda=date.getDate() < 10 ? "0"+ date.getDate():date.getDate();
            var endh=date.getHours() < 10 ? "0"+ date.getHours():date.getHours();
            var endm=date.getMinutes() < 10 ? "0"+ date.getMinutes():date.getMinutes();
            $("#timestart").val(year+"-"+mon+"-"+da+" 20:30:00");
            $("#timeend").val(endyear+"-"+endmon+"-"+endda+" 20:00:00");
            $("#upStartTime").val(year+"-"+mon+"-"+da+" 20:00:00");
            $("#upEndTime").val(endyear+"-"+endmon+"-"+endda+" 20:00:00");
        })
	</script>
</body>

</html>
